<?php
define('IN_QY',true);
session_start();
require("include/common.inc.php");
require_once('config.php');


if($_POST['dlcode']!=$_COOKIE['code']){
	
	   $arr = array('error'=>1,'msg'=>'success');
	   echo json_encode($arr);
	   exit;
}

    $sql1 = "select * from tbl_user where userid ='".$_POST['dlphone']."'";
    $query1 = mysql_query($sql1);
    $row1 = mysql_fetch_array($query1);
	
	if(!$row1){
		
	   $arr = array('error'=>2,'msg'=>'success');
	   echo json_encode($arr);	
       exit;	   
	}	
	
    if($row1){  
	
    setcookie("username",$row1['userid'],time()+(3600*8*1*1),"/");
    setcookie("userid",$row1['id'],time()+(3600*8*1*1),"/");
    setcookie("shuyu",$row1['shuyu'],time()+(3600*8*1*1),"/");  
    setcookie("addmima",strtotime($row1['change_pwd_time']),time()+(3600*8*1*1),"/");   
//	
		if($_COOKIE['popped']){
		$popped=$_COOKIE['popped'];
		}
		else {	
	
		$popped=1;
		}
		
	    $arr = array('error'=>0,'msg'=>'success','popped'=>$popped);
		   
	   echo json_encode($arr);	
       exit;	
		
    }

	
?>